// 引用网络请求中间件
import request from '../../utils/request.js';

export function getList(data) {
	let {
		pageNum,
		pageSize,
		name
	} = data
	if (name) {
		return request({
			url: `/api/device/selectUserOwnDeviceList?name=${name}&pageNum=${pageNum}&pageSize=${pageSize}`,
			method: 'GET',
		})
	} else {
		return request({
			url: `/api/device/selectUserOwnDeviceList?pageNum=${pageNum}&pageSize=${pageSize}`,
			method: 'GET',
		})
	}

}


export function add(data) {
	return request({
		url: `/api/device/addAdvice`,
		method: 'POST',
		data
	})
}

export function detail(deviceId) {
	return request({
		url: `/api/device/${deviceId}`,
		method: 'GET',
	})
}

export function edit(data) {
	return request({
		url: `/api/device/editDevice`,
		method: 'PUT',
		data
	})
}